<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <h:outputStylesheet name="css/default.css"/>
        <h:outputStylesheet name="css/cssLayout.css"/>
        <title>
            <ui:insert name="title">#{bundle.AplicationName}</ui:insert>
        </title>
    </h:head>

    <h:body>
        <f:view locale="#{languageController.localeCode}">
            <div id="top">
                <ui:insert name="top">
                    <div style="position: relative; overflow: hidden;">
                        <h:form id="top-form">
                            <h2 style="float: left; width: 200px;">
                                <h:outputLink value="index.xhtml">#{bundle.AplicationName}</h:outputLink>
                            </h2>
                            <div class="top-links">
                                <h:link value="#{bundle.InvoicesLink}" outcome="/invoice/List"/>
                                <h:link value="#{bundle.ProductsLink}" outcome="/product/List"/>
                                <h:link value="#{bundle.CustomersLink}" outcome="/customer/List"/>
                            </div>
                            <div class="top-options">
                                <h:commandLink value="#{bundle.MyAccount}" action="#{userController.prepareAccount()}" rendered="#{authController.isLoggedIn()}"/>
                                <h:commandLink value="#{bundle.Logout}" action="#{authController.logout()}" rendered="#{authController.isLoggedIn()}" />  
                                <h:commandLink id="register-button" value="#{bundle.Register}" action="/register.xhtml" rendered="#{not authController.isLoggedIn()}" />
                                <h:commandLink id="login-button" value="#{bundle.Login}" action="/authenticate.xhtml" rendered="#{not authController.isLoggedIn()}" />  
                                <h:selectOneMenu value="#{languageController.localeCode}" valueChangeListener="#{languageController.countryLocaleCodeChanged}">
                                    <f:selectItem itemValue="pl" itemLabel="#{bundle.Language_pl}"/>
                                    <f:selectItem itemValue="en" itemLabel="#{bundle.Language_en}"/>
                                    <f:ajax event="change" execute="@form" render="@all" />
                                </h:selectOneMenu>
                            </div>
                        </h:form>
                    </div>
                </ui:insert>
            </div>
            <div>
                <div id="left">
                    <ui:insert name="sidebar">
                    </ui:insert>
                </div>
                <div id="content" class="left_content">
                    <ui:insert name="body"></ui:insert>
                </div>
            </div>
            <div id="bottom">
                <ui:insert name="bottom">
                    <div>
                        Copyright © 2013 Faktury, all rights reserved.
                    </div>
                </ui:insert>
            </div>
        </f:view>
    </h:body>

</html>
